namespace a = "http://relaxng.org/ns/compatibility/annotations/1.0"
namespace hr = "http://eric.van-der-vlist.com/ns/person"
namespace local = ""
default namespace ns1 = "http://eric.van-der-vlist.com/ns/library"
namespace sn = "http://www.snee.com/ns/stages"

start =
  element library { book-element+ }
  | book-element
  | author-element
  | character-element
include "foreign.rnc" {
  foreign-elements = element * - (local:* | ns1:* | hr:*) { anything }*
  foreign-attributes = attribute * - (local:* | ns1:* | hr:*) { text }*
}
author-element =
  element hr:author {
    attribute id {
      xsd:NMTOKEN { maxLength = " 16 " }
    },
    name-element,
    born-element,
    dead-element?
  }
include "book-content.rnc"
book-content &= foreign-nodes
book-element = element book { book-content }
born-element = element hr:born { xsd:date }
character-element =
  grammar {
    start =
      element character {
        attribute id { text },
        parent name-element,
        parent born-element,
        parent qualification-element
      }
  }
dead-element = element hr:dead { xsd:date }
isbn-element = element isbn { foreign-attributes, token }
name-element = element hr:name { xsd:token }
qualification-element = element qualification { text }
title-element = element title { foreign-attributes, text }
available-content = "true" | xsd:token " false " | " "
